#include "../../client/rpc_client.hpp"

void cb(const std::string &key,const std::string &msg)
{
    ILOG("%s 主题收到推送过来的信息：%s",key.c_str(),msg.c_str());
}
int main()
{
    // 1.实例化客户端对象
    auto client = std::make_shared<myrpc::client::TopicClient>("127.0.0.1", 7070);
    // 2.创建主题
    bool ret = client->create("hello");
    if (ret == false)
    {
        ELOG("创建主题失败！");
        return 1;
    }
    //3.订阅主题
    ret=client->subscribe("hello",cb);

    //4.等待-退出
    std::this_thread::sleep_for(std::chrono::seconds(100));
    client->shutdown();
    return 0;
}